package cn.kgc.controller;

import cn.kgc.entity.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 蒋小聪
 * @since 2023/2/23
 */
@RestController
public class HelloWorldController {
    //把配置文件的内容注入到属性中
    @Value("${name}")
    private String name;

    @Autowired
    private Person person;
    @RequestMapping("/hello")
    public String hello(){

        return "hello-springboot!"+name+person.getName()+"\t"+person.getSex()+"\t"+person.getAge();
    }

}
